Skip to content

Adds Telemetry#38

Open
brob wants to merge 9 commits intomainfrom
telemetry
Open

Adds Telemetry#38
brob wants to merge 9 commits intomainfrom
telemetry

Conversation

@brob
Copy link
Copy Markdown
Contributor

@brob brob commented Apr 24, 2026

Adds usage data collection to all the commands as a first step toward broader telemetry collection.

@brob brob requested a review from a team April 24, 2026 17:57
@brob brob self-assigned this Apr 24, 2026
@andrewpai andrewpai requested a review from Copilot April 30, 2026 20:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first-pass telemetry implementation across CLI commands, including a persistent config and enable/disable toggles.

Changes:

  • Introduces a PostHog client plus config helpers (loadConfig, allowsTelemetry, logEvent) in shared utils.
  • Adds a postinstall script to generate a per-install UUID + default telemetry setting.
  • Wires logEvent(...) into multiple command entrypoints and adds telemetry:enable / telemetry:disable commands.

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/utils.ts Adds PostHog client initialization, config loading, and event capture helpers.
src/postinstall.ts Creates a config file under dist/.fa/ during install.
src/commands/theme-watch.ts Emits telemetry event on command start.
src/commands/theme-upload.ts Emits telemetry event on command start.
src/commands/theme-download.ts Emits telemetry event on command start.
src/commands/message-upload.ts Emits telemetry event on command start.
src/commands/message-download.ts Emits telemetry event on command start.
src/commands/lambda-update.ts Emits telemetry event on command start.
src/commands/lambda-retrieve.ts Emits telemetry event on command start.
src/commands/lambda-delete.ts Emits telemetry event on command start.
src/commands/import-generate.ts Emits telemetry event on command start.
src/commands/email-watch.ts Emits telemetry event on command start.
src/commands/email-upload.ts Emits telemetry event on command start.
src/commands/email-download.ts Emits telemetry event on command start.
src/commands/email-html-to-text.ts Emits telemetry event on command start.
src/commands/email-duplicate.ts Emits telemetry event on command start.
src/commands/email-create.ts Emits telemetry event on command start.
src/commands/check-common-config.ts Emits telemetry event on command start.
src/commands/kickstart-start.ts Emits telemetry event on command start.
src/commands/kickstart-stop.ts Emits telemetry event on command start.
src/commands/kickstart-kill.ts Emits telemetry event on command start (+ minor formatting change).
src/commands/kickstart-install.ts Emits telemetry event on command start.
src/commands/telemetry-enable.ts Adds command to enable telemetry in config.
src/commands/telemetry-disable.ts Adds command to disable telemetry in config.
src/commands/index.ts Exports the new telemetry commands.
package.json Adds postinstall script and posthog-node dependency.
package-lock.json Locks new dependency graph for posthog-node.
.gitignore Ignores .fa/ directory.
Comments suppressed due to low confidence (1)

package.json:57

  • posthog-node@^5.21.2 declares an engine requirement of Node >= 20 (per the lockfile). The README currently says the CLI is tested on Node 19 as well, so this dependency update will make installs/runtime on Node 19 unreliable. Either bump/document the minimum Node version (e.g., add an engines field) or use a PostHog client version compatible with the supported Node range.
    "posthog-node": "^5.21.2",
    "queue": "7.0.0",
    "remove-undefined-objects": "3.0.0",
    "uuid": "9.0.0",
    "yocto-spinner": "^1.1.0"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils.ts Outdated
Comment thread src/utils.ts
Comment thread src/postinstall.ts Outdated
Comment thread package.json Outdated
Comment thread src/utils.ts
Comment on lines +13 to +19
export const posthogClient = new PostHog(
'phc_nB6C2uZX2LA6ce6VAaWZxBYPtq1wYH5x8A3n36DaLzQ',
{ host: 'https://us.i.posthog.com' }
)



Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PostHog API key is hard-coded in the source. Even if it's a “public” project key, committing it makes rotation and environment-specific configuration difficult. Consider reading the key (and host) from an environment variable or config, and only initializing the client when telemetry is actually enabled.

Suggested change
export const posthogClient = new PostHog(
'phc_nB6C2uZX2LA6ce6VAaWZxBYPtq1wYH5x8A3n36DaLzQ',
{ host: 'https://us.i.posthog.com' }
)
const posthogEnabled = process.env.POSTHOG_ENABLED === 'true';
const posthogApiKey = process.env.POSTHOG_API_KEY;
const posthogHost = process.env.POSTHOG_HOST ?? 'https://us.i.posthog.com';
export const posthogClient = posthogEnabled && posthogApiKey
? new PostHog(posthogApiKey, { host: posthogHost })
: null;

Copilot uses AI. Check for mistakes.
Comment thread src/utils.ts
Comment thread src/commands/telemetry-disable.ts
Comment thread src/commands/telemetry-enable.ts
Comment thread src/postinstall.ts Outdated
Comment thread src/postinstall.ts
Comment thread src/utils.ts Outdated
@brob brob requested a review from andrewpai May 1, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants